<template>
  <BasicModal :title="title" :width="400" v-bind="$attrs" @ok="methods.handleSubmit" @register="registerModel" :useWrapper="true" destroyOnClose>
    <BasicForm @register="registerForm" />
  </BasicModal>
</template>
<script setup lang="ts">
  import ApiV1 from '@/views/common/operate/ApiV1';
  import BasicForm from '@/components/Form/src/BasicForm.vue';
  import BasicModal from '@/components/Modal/src/BasicModal.vue';
  import { useCustomerHandleSchemaForm } from '@/views/system/basic/contacts/customer.data';

  const emit = defineEmits(['success', 'register']);
  const { registerForm, registerModel, methods, formMethods, title } = ApiV1.useHandle(emit, {
    formProps: { schemas: useCustomerHandleSchemaForm(), baseColProps: { span: 24 } },
    title: '联系资料',
    customDetails: (data) => {
      formMethods.setFieldsValue(data);
    },
  });
</script>
